package com.joker.logquery.controller;

import com.joker.logquery.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * Description: LogController
 *
 * @author Joker
 * @version 1.0.0
 */
@RestController
@RequestMapping("/logs")
public class LogController {
    @Autowired
    private LogService logService;

    @GetMapping("/test")
    public String showLogFileForm() {
        return "test success";
    }

    @PostMapping("/query/result")
    public ResponseEntity<String> getLogFileContent(@RequestParam String path, @RequestParam String query) {
        String content = logService.getLogContent(path, query); // 假设你的LogService中有对应的方法用于匹配查询内容
        return ResponseEntity.ok(content);
    }
}
